import requestProxy from '@/utils/request';
const { request } = requestProxy;
// 获取筛选条件
export function getFilterList(params) {
  return request({
    url: '/admin/medium/filter',
    method: 'get',
    params
  });
}

// 获取媒介数据
export function getMediumList(params) {
  return request({
    url: '/admin/medium/list',
    method: 'get',
    params
  });
}

// 修改媒介数据
export function editInfoApi(params, paramsType) {
  return request({
    url: `/admin/medium/info/${paramsType}`,
    method: 'put',
    data: params
  });
}

// 获取备注列表
export function getRemarkList(params) {
  return request({
    url: '/admin/medium/remark/list',
    method: 'get',
    params
  });
}
// 修改备注
export function editRemarkApi(params) {
  return request({
    url: '/admin/medium/remark',
    method: 'put',
    data: params
  });
}

// 删除备注
export function deleteRemark(params) {
  return request({
    url: '/admin/medium/remark',
    method: 'delete',
    data: params
  });
}

// 修改案例
export function editCaseApi(params) {
  return request({
    url: '/admin/medium/case',
    method: 'put',
    data: params
  });
}
// 获取七牛token
export function getToken() {
  return request({
    url: '/common/upToken',
    method: 'get'
  });
}

// 导出资源
export function exportList(params) {
  return request({
    url: '/admin/medium/export',
    method: 'get',
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/octet-stream',
      'Content-Disposition': 'attachment;filename=kpi.xlsx'
    },
    params
  });
}

// 获取导入导出进度
export function getProcess(params) {
  return request({
    url: '/admin/medium/importSchedule',
    method: 'get',
    params
  });
}

// 导出订单
export function exportOrder(params) {
  return request({
    url: '/admin/medium/export/order',
    method: 'get',
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/octet-stream',
      'Content-Disposition': 'attachment;filename=kpi.xlsx'
    },
    params
  });
}

// 订单列表
export function meidumOrderList(params) {
  return request({
    url: '/admin/medium/order/list',
    method: 'get',
    params
  });
}
// 订单详情
export function meidumOrderDetail(params) {
  return request({
    url: '/admin/medium/order/detail',
    method: 'get',
    params
  });
}

// 订单详情-操作日志
export function meidumOrderDetailLog(params) {
  return request({
    url: '/admin/medium/order/detail/log',
    method: 'get',
    params
  });
}

// 订单详情-操作日志-编辑
export function meidumOrderDetailLogEdit(data) {
  return request({
    url: '/admin/medium/log/edit',
    method: 'post',
    data
  });
}

// 订单详情
export function searchUser(params) {
  return request({
    url: '/admin/medium/search/user',
    method: 'get',
    params
  });
}

// 订单详情
export function addMediumUser(params) {
  return request({
    url: '/admin/medium/order/adduser',
    method: 'post',
    data: params
  });
}

// 订单详情
export function createOrder(params) {
  return request({
    url: '/admin/medium/create/order',
    method: 'post',
    data: params
  });
}
/**
 * 销售操作
 */
// 提交订单
export function submitOrder(params) {
  return request({
    url: '/admin/medium/order/submit',
    method: 'post',
    data: params
  });
}
// 关闭订单
export function closeOrder(params) {
  return request({
    url: '/admin/medium/order/close',
    method: 'post',
    data: params
  });
}
// 确认和取消达人
export function confirmMediumUser(params) {
  return request({
    url: '/admin/medium/order/confirm',
    method: 'post',
    data: params
  });
}
// 响应和取消达人
export function responseMediumUser(params) {
  return request({
    url: '/admin/medium/order/response',
    method: 'post',
    data: params
  });
}

// 完成
export function complateUser(params) {
  return request({
    url: '/admin/medium/order/complate',
    method: 'post',
    data: params
  });
}

// 达人价格修改：媒介在响应前可以修改
export function userPriceEdit(params) {
  return request({
    url: '/admin/medium/orderuser/edit',
    method: 'post',
    data: params
  });
}

export function deleteMediumUser(params) {
  return request({
    url: '/admin/medium/order/delete',
    method: 'post',
    data: params
  });
}

export function editOrderInfo(params) {
  return request({
    url: '/admin/medium/order/edit',
    method: 'post',
    data: params
  });
}
// 销售终止订单
export function endOrder(params) {
  return request({
    url: '/admin/medium/order/end',
    method: 'post',
    data: params
  });
}

// 统计订单列表
export function totalOrder(params) {
  return request({
    url: '/admin/medium/statistics',
    method: 'get',
    params
  });
}

// 统计列表详情
export function totalOrderDetail(params) {
  return request({
    url: '/admin/medium/statistics/info',
    method: 'get',
    params
  });
}

// 批量删除订单
export function batchDelMedium(data) {
  return request({
    url: '/admin/medium/delete/batch',
    method: 'delete',
    data
  });
}
